package nowcoder.hw.hj17;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main1 {

    public static void main(String[] args) throws IOException {

        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        String cmd = bufferedReader.readLine();
        String[] strings = cmd.split(";");

        int x = 0, y = 0;
        for (int i = 0; i < strings.length; i++) {
            if (isBlank(strings[i])) continue;

            int step = 0;
            try {
                step = Integer.valueOf(strings[i].substring(1));
            } catch (Exception e) {
                continue;
            }
            switch (strings[i].charAt(0)) {
                case 'W': {
                    y += step;
                    break;
                }
                case 'A': {
                    x -= step;
                    break;
                }

                case 'S': {
                    y -= step;
                    break;
                }
                case 'D': {
                    x += step;
                    break;
                }
                default:
                    break;
            }
        }
        System.out.println(x + "," + y);


    }

    public static boolean isBlank(String s) {
        return s == null || s.trim().isEmpty();
    }
}